/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

/**
 *
 * @author Alberto
 */
public class Time {

    private int hour;
    private int minute;
    private int second;

    public Time(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getMinute() {
        return minute;
    }

    public void setMinute(int minute) {
        this.minute = minute;
    }

    public int getSecond() {
        return second;
    }

    public void setSecond(int second) {
        this.second = second;
    }

    public long changeSeconds(){
            long seconds = 0;
            seconds += this.hour*3600;
            seconds += this.minute*60;
            seconds += this.second;
            return seconds;
    }

    public int compareTo(Time time){
        int res = 0;
        if(time.hour>this.hour){
            res = -1;
        }else if(time.hour<this.hour){
            res = 1;
        }else{
            if(time.minute>this.minute){
                res = -1;
            }else if(time.minute<this.minute){
                res = 1;
            }else{
                if(time.second>this.second){
                    res = -1;
                }else if(time.second<this.second){
                    res = 1;
                }
            }
        }
        return res;
    }

    @Override
    public String toString(){
        return (hour+":"+minute+":"+second);
    }

    @Override
    public Object clone() throws CloneNotSupportedException{
        Time clon = new Time(this.hour,this.minute,this.second);
        return clon;
    }

}
